package 开始的算法算法入门8月.双指针;
// https://leetcode-cn.com/problems/rotate-array/
public class 旋转数组0813 {
    //翻转数组
    public void rotate(int[] nums, int k) {
        k=k%nums.length;
        reverse(nums,0,nums.length-1);
        reverse(nums,0,k-1);
        reverse(nums,k,nums.length-1);
    }
    public void reverse(int nums[],int start,int end){
        while(start<end){
            int tmp=nums[start];
            nums[start]=nums[end];
            nums[end]=tmp;
            start++;
            end--;
        }
    }




}
